Title Banner

Previous Book Contents Book Index Next

Inside Macintosh: QuickDraw GX Graphics /
Chapter 6 - Picture Shapes / Using Picture Shapes


Creating Picture Hierarchies

QuickDraw GX allows the items in a picture shape to reference other picture shapes. You can use any of the functions that allow you to add items to pictures (GXNewPicture, GXSetPicture, GXSetPictureParts) to create picture hierarchies.

When drawing a picture hierarchy, QuickDraw GX concatenates the mapping and clipping information contained in the transform objects (or overriding transform objects) at each level of the hierarchy. As an example, Listing 6-14 shows how QuickDraw GX concatenates mapping information from two levels of a picture hierarchy. In this example, the house picture from Figure 6-21 on page 6-35 is added to another picture as an item with an overriding transform that rotates the house clockwise 90 degrees. In turn, this picture is added as an item to yet another picture, with the same overriding transform.

Listing 6-14 Creating a picture hierarchy

gxShape rootPicture, level1Picture;
gxTransform rotateHouse;
.
.
.
rotateHouse = GXNewTransform();
GXRotateTransform(rotateHouse, ff(90), ff(150), ff(100));
   
level1Picture =  GXNewPicture(1, 
                              &housePicture, 
                              nil, nil, 
                              &rotateHouse);
rootPicture = GXNewPicture(1, 
                           &level1Picture, 
                           nil, nil, 
                           &rotateHouse);

GXDrawShape(rootPicture);
When QuickDraw GX draws the root-level picture, it concatenates the information in the two overriding transforms, and draws the house picture rotated clockwise 180 degrees, as shown in Figure 6-27.

Figure 6-27 A house rotated by 90 degrees two times

For more information about picture hierarchies and transform concatenation, see "Picture Hierarchies" beginning on page 6-18 and "Transform Concatenation" beginning on page 6-19.


Previous Book Contents Book Index Next

© Apple Computer, Inc.
7 JUL 1996




Navigation graphic, see text links

Main | Page One | What's New | Apple Computer, Inc. | Find It | Contact Us | Help